//program to check if the entered integers are fibonacci series or not

import java.util.Arrays;

public class FibonacciCheck {

	
	public static void main(String[] args) {
		
		int[] arr={1,3,5,13,8,55,89,1,0,21,34,2,144};
		
		int i;
		int j;
		
		//arrange the numbers in ascending order first
		
		for(i=0;i<arr.length; i++)
		{
			for(j=i+1;j<arr.length;j++)
			{
				if (arr[i]>arr[j])
				{
									
					int temp;
					temp=arr[i];
					arr[i]=arr[j];
					arr[j]=temp;
													
			}
		}
	}
		System.out.println(Arrays.toString(arr));
		
		//find if the series is fibonacci or not
		boolean found=false;
		for(i=2; i<arr.length; i++)
		{
			found=false;
			 if (arr[i]==arr[i-1]+arr[i-2])
				 found=true;
			 else 
				 {				 
				 System.out.println("it's not a fibonacci series");
				 break;
				 }
			 
		}
		if(found)
		 System.out.println("It's a fibonacci series");
		
		
	}

}
